home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
editbt
/
employee.frm
< prev
next >
Wrap
Text File
|
1995-05-08
|
12KB
|
433 lines
VERSION 2.00
Begin Form frmEmployees
BackColor = &H00FFFFFF&
Caption = "Employee Records"
ClientHeight = 3495
ClientLeft = 1830
ClientTop = 1620
ClientWidth = 5775
Height = 3900
Left = 1770
LinkTopic = "Form1"
ScaleHeight = 3495
ScaleWidth = 5775
Top = 1275
Width = 5895
Begin ComboBox cbPosition
BackColor = &H00C0C0C0&
Height = 300
Left = 2400
TabIndex = 7
Text = " "
Top = 1675
Width = 3105
End
Begin MaskEdBox tbSSN
BackColor = &H00C0C0C0&
DataField = "SSN"
DataSource = "Data1"
Format = "###-##-####"
Height = 285
Left = 2400
MousePointer = 3 'I-Beam
PromptChar = "_"
PromptInclude = 0 'False
TabIndex = 5
Top = 1175
Width = 1400
End
Begin CheckBox Check1
Alignment = 1 'Right Justify
Caption = "&Active:"
DataField = "Active"
DataSource = "Data1"
Height = 225
Left = 1350
TabIndex = 8
Top = 2115
Width = 1260
End
Begin TextBox tbLName
BackColor = &H00C0C0C0&
DataField = "Last Name"
DataSource = "Data1"
Height = 285
Left = 2415
MaxLength = 15
MousePointer = 3 'I-Beam
TabIndex = 3
Text = " "
Top = 675
Width = 1875
End
Begin TextBox tbFName
BackColor = &H00C0C0C0&
DataField = "First Name"
DataSource = "Data1"
Height = 285
Left = 2400
MaxLength = 15
MousePointer = 3 'I-Beam
TabIndex = 1
Text = " "
Top = 175
Width = 1875
End
Begin PictureBox picCommand
Height = 525
Index = 0
Left = 0
ScaleHeight = 495
ScaleWidth = 5775
TabIndex = 9
Top = 2700
Width = 5800
Begin CommandButton Command1
Caption = "E&xit Program"
Height = 330
Left = 3000
TabIndex = 11
Top = 75
Width = 1400
End
Begin CommandButton cmdedit
Caption = "&Edit"
Height = 330
Left = 1400
TabIndex = 10
Top = 75
Width = 1400
End
End
Begin Data Data1
BackColor = &H00C0C0C0&
Caption = "Employees"
Connect = ""
DatabaseName = "C:\VB\EMPLOYEE.MDB"
Exclusive = 0 'False
Height = 300
Left = 0
Options = 0
ReadOnly = 0 'False
RecordSource = "Employees"
Top = 3220
Width = 5800
End
Begin PictureBox picCommand
Height = 525
Index = 1
Left = 0
ScaleHeight = 495
ScaleWidth = 5775
TabIndex = 13
Top = 2700
Visible = 0 'False
Width = 5800
Begin CommandButton cmdSave
Caption = "&Save"
Default = -1 'True
Height = 330
Left = 1400
TabIndex = 12
Top = 75
Width = 1400
End
Begin CommandButton cmdCancel
Cancel = -1 'True
Caption = "&Cancel"
Height = 330
Left = 3000
TabIndex = 14
Top = 75
Width = 1400
End
End
Begin Label lblFields
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "&Position:"
Height = 210
Index = 3
Left = 195
TabIndex = 6
Top = 1700
Width = 1800
End
Begin Label lblFields
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "&Soc. Sec. No.:"
Height = 210
Index = 2
Left = 195
TabIndex = 4
Top = 1200
Width = 1800
End
Begin Label lblFields
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "&Last Name:"
Height = 210
Index = 1
Left = 195
TabIndex = 2
Top = 700
Width = 1800
End
Begin Label lblFields
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "&First Name:"
Height = 210
Index = 0
Left = 195
TabIndex = 0
Top = 200
Width = 1800
End
End
'-----------------------------------------------------
'
' Copyright (c) 1994 by Barth Riley
'
' Project Name: Edit Data Demonstration
' Description: Implements Edit button and
' read-only controls with a
' Data Control
' Author: Barth Riley
' Copyright date: Jan 29th, 1994
' Version: 1.0
' Project file: EDITDATA.MAK
' Number of forms: 1
' Number of modules: 1
'-------------------------------------------------
'---Dim Variables
Dim fEdit As Integer ' Edit mode flag
Dim fLoading As Integer ' True when a new rec. is loaded
Sub cbPosition_DropDown ()
If Not fEdit Then
' Temporarily disable the control
Beep
cbPosition.SelLength = 0
cbPosition.Enabled = False
cbPosition.Enabled = True
End If
End Sub
Sub cbPosition_GotFocus ()
If fEdit Then
cbPosition.SelStart = 0
cbPosition.SelLength = Len(cbPosition.Text)
End If
End Sub
Sub cbPosition_KeyDown (KeyCode As Integer, Shift As Integer)
If Not fEdit Then
Beep
KeyCode = 0
End If
End Sub
Sub cbPosition_KeyPress (KeyAscii As Integer)
If Not fEdit Then
Beep
KeyAscii = 0
End If
End Sub
Sub cbPosition_LostFocus ()
cbPosition.SelLength = 0
End Sub
Sub Check1_Click ()
If fEdit Or fLoading Then
Else
'-----------------------------------------------
' The Data control will intialize
' the values of all bound controls
' prior to the Form_Load event. Hence
' both fEdit and fLoading will be False
' when the Check1 control is initialized.
' It will "appear" therefore that the user
' is trying to alter the value of the ckeck box
' when not in edit mode. To overcome this problem,
' I've used theTag property of the control to
' indicate whether the control has been
' initialized: If it has no value, then it
' is set to "Loading". Otherwise, a warning
' beep is sounded.
'---------------------------------------------------
If Check1.Tag = "" Then
Check1.Tag = "Loaded"
Else
Beep
End If
Check1.Value = (Data1.Recordset("Active") * -1)
End If
End Sub
Sub cmdCancel_Click ()
Data